/* Copyright (c) 2006 celumsolutions. All Rights Reserved. */
package com.swingolf.tool;

/**
 * @author rudolf.traunmueller
 * @since 21.09.11
 */
public class PlayerDTO {

  private String forename;
  private String lastname;
  private int year;
  private double hcp;
  private String team;
  private String nation;
  private String clazz;

  public PlayerDTO(String s, String s1, String clazz, int i, double v, String s2, String s3) {
    this.forename = s;
    this.lastname = s1;
    this.clazz = clazz;
    this.year = i;
    this.hcp = v;
    this.team = s2;
    this.nation = s3;
  }

  public String getForename() {
    return forename;
  }

  public void setForename(String forename) {
    this.forename = forename;
  }

  public String getLastname() {
    return lastname;
  }

  public void setLastname(String lastname) {
    this.lastname = lastname;
  }

  public int getYear() {
    return year;
  }

  public void setYear(int year) {
    this.year = year;
  }

  public double getHcp() {
    return hcp;
  }

  public void setHcp(double hcp) {
    this.hcp = hcp;
  }

  public String getTeam() {
    return team;
  }

  public void setTeam(String team) {
    this.team = team;
  }

  public String getNation() {
    return nation;
  }

  public void setNation(String nation) {
    this.nation = nation;
  }

  public String getClazz() {
    return clazz;
  }

  public void setClazz(String clazz) {
    this.clazz = clazz;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    PlayerDTO p = (PlayerDTO) o;

    if (Double.compare(p.hcp, hcp) != 0) return false;
    if (year != p.year) return false;
    if (clazz != null ? !clazz.equals(p.clazz) : p.clazz != null) return false;
    if (forename != null ? !forename.equals(p.forename) : p.forename != null) return false;
    if (lastname != null ? !lastname.equals(p.lastname) : p.lastname != null) return false;
    if (nation != null ? !nation.equals(p.nation) : p.nation != null) return false;
    if (team != null ? !team.equals(p.team) : p.team != null) return false;

    return true;
  }

  @Override
  public int hashCode() {
    int result;
    long temp;
    result = forename != null ? forename.hashCode() : 0;
    result = 31*result + (lastname != null ? lastname.hashCode() : 0);
    result = 31*result + year;
    temp = hcp != +0.0d ? Double.doubleToLongBits(hcp) : 0L;
    result = 31*result + (int) (temp ^ (temp >>> 32));
    result = 31*result + (team != null ? team.hashCode() : 0);
    result = 31*result + (nation != null ? nation.hashCode() : 0);
    result = 31*result + (clazz != null ? clazz.hashCode() : 0);
    return result;
  }

  @Override
  public String toString() {
    return
        "" + forename +
            ", " + lastname +
            ", " + year +
            ", " + hcp +
            ", " + team +
            ", " + nation +
            ", " + clazz;
  }

  public String writeShort() {
    return
        "" + lastname +
            " " + forename +
            " (" + team +
            ", " + nation +
            ")";
  }
}
